/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By
 * Copyright authorization contact 18814114118
 */
package com.shop.cereshop.business.controller.bond;

import com.shop.cereshop.business.page.bond.ShopRechargeVO;
import com.shop.cereshop.business.param.bond.ShopRechargeDTO;
import com.shop.cereshop.business.service.bond.CereShopBondRechargeService;
import com.shop.cereshop.business.service.bond.CereShopBondService;
import com.shop.cereshop.business.utils.ContextUtil;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.domain.bond.CereShopBond;
import com.shop.cereshop.commons.domain.bond.CereShopBondRecharge;
import com.shop.cereshop.commons.domain.wallet.Recharge;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * 店铺保证金模块
 * @author lx
 */
@Slf4j
@RestController
@RequestMapping("/bond")
@Api(value = "店铺保证金模块", tags = "店铺保证金模块")
@RequiredArgsConstructor
public class CereShopBondController {

  private final CereShopBondService cereShopBondService;

  private final CereShopBondRechargeService cereShopBondRechargeService;

  //保证金首页查询接口
  @GetMapping("/index")
  @ApiOperation(value = "保证金首页查询接口")
  public Result<CereShopBond> getBondIndex() throws CoBusinessException {
    Long shopId = ContextUtil.getShopId();
    if (shopId == null) {
      return Result.failed(CoReturnFormat.USER_NOT_LOGIN);
    }
    CereShopBond result = cereShopBondService.lambdaQuery()
            .eq(CereShopBond::getShopId, shopId)
            .one();
    return Result.success(result);
  }
}